<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateEncyclopediaCategoryTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('encyclopedia_category', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('author_id')->comment('创建id');
            $table->string('name', 64)->comment('分类名称');
            $table->string('code')->unique()->comment('编码');
            $table->string('describe')->nullable()->comment('描述');
            $table->string('keyword')->comment('关键词');
            $table->boolean('status')->default(true)->comment('状态');
            $table->unsignedInteger('parent_id')->nullable()->comment('上级分类');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('encyclopedia_category');
    }
}
